<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
    <link rel="icon" type="image/png" href="">
    <title></title>
    <link href="${ctx}/static/mobileweb/assets/css/font-open.css" rel="stylesheet" type='text/css'>
    <link href="${ctx}/static/mobileweb/assets/css/normalize.css" rel="stylesheet" type='text/css'>
    <link href="${ctx}/static/mobileweb/assets/css/furatto.css" rel="stylesheet" type='text/css'>
    <link href="${ctx}/static/mobileweb/assets/css/font-awesome.css" rel="stylesheet" type='text/css'>
    <link href="${ctx}/static/mobileweb/assets/css/znc.css" rel="stylesheet" type='text/css'>
</head>
<body>

<div class="row">
    <div class="login-form">
        <h4>完善个人资料</h4>
        <br/>

        <form action="" method="post" id="save_form">
            <input type="hidden" name="mid" value="${member.id!}">
            <input type="hidden" name="wxno" value="${wxno!}">
            <input type="hidden" name="member.id" value="${member.id!}">
            <label for="name">姓名:</label>
            <input type="text" name="member.name" id="name" value="${member.name!}" placeholder="姓名" required/>
            <label for="radio">性别:</label>
            <input type="radio" name="member.gender" id="m" value="1" required/>
            <label for="m">男</label>
            <input type="radio" name="member.gender" id="f" value="0" required/>
            <label for="f">女</label>
            <label for="id_card">身份证号码:</label>
            <input type="text" name="member.id_card" id="id_card" value="" placeholder="身份证号码" required/>
            <label for="postcode">邮编:</label>
            <input type="number" name="member.postcode" id="postcode" value="" placeholder="邮编" required/>
            <label for="mail_address">邮寄地址:</label>
            <textarea name="member.mail_address" id="mail_address" placeholder="邮寄地址"></textarea>
            <input type="submit" id="ok_btn" value="确认" class="button primary"/>
            <input type="button" id="cancel" value="跳过" class="button"/>
        </form>
    </div>
</div>

<script src="${ctx}/static/mobileweb/scripts/jquery-1.7.2.min.js"></script>
<script src="${ctx}/static/mobileweb/scripts/jquery-html5Validate.js"></script>

<script type="text/javascript" charset="utf-8" src="${ctx}/static/mobileweb/assets/js/furatto.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        var form_url = '${ctx}/mobileweb/member/save';
        $('#save_form').html5Validate(function () {
            $.post(form_url,
                    {
                        'mid'                : '${mid!}', 'wxno': '${wxno!}',
                        'member.id'          : '${mid!}',
                        'member.name'        : $('#name').val(),
                        'member.gender'      : $('input[type=radio][name="member.gender"]:checked').val(),
                        'member.id_card'     : $('#id_card').val(), 'member.postcode': $('#postcode').val(),
                        'member.mail_address': $('#mail_address').val()
                    }, function (rst) {
                        if (rst.status == 'OK') {

                            window.location.href = '${ctx}/mobileweb/member?mid=${mid!}&wxno=${wxno!}'
                        } else {
                            $('#ok_btn').testRemind(rst.message);
                        }
                    })
        });

        $('input#cancel').click(function () {
            window.location.href = '${ctx}/mobileweb/member?mid=${mid!}&wxno=${wxno!}'
        })
    })
</script>
</body>
</html>